home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 13 / CU Amiga Magazine's Super CD-ROM 13 (1997)(EMAP Images)(GB)(Track 1 of 2)[!][issue 1997-08].iso / CUCD / Graphics / irit70 / bin / difftree < prev    next >
Text File  |  1996-05-20  |  1KB  |  56 lines

  1. #!/bin/csh -f
  2. #
  3. # Compares two source trees
  4. #
  5. # Usage: "difftree src-tree dst-tree",
  6. #
  7. #                         Gershon Elber, Jan 1996.
  8. #
  9.  
  10. set reverse = 0
  11. if ("$1" == "-r") then
  12.     shift
  13.     set reverse = 1
  14. endif
  15.  
  16. if ( $#argv != 2 ) then
  17.     echo "Usage: difftree src-tree dst-tree"
  18.     exit 1
  19. endif
  20.  
  21. set src = $1
  22. set dest = $2
  23.  
  24. if ( ! -e $src ) then
  25.     echo "Source directory does not exists"
  26.     exit 1
  27. endif
  28. if ( ! -e $dest ) then
  29.     echo "Destination directory does not exists"
  30.     exit 1
  31. endif
  32.  
  33. diff -rq $src $dest | awk \
  34.     'BEGIN {    \
  35.     } \
  36.     (($1 == "Files") && ($3 == "and") && ($5 == "differ")) { \
  37.         if ( $reverse ) { \
  38.             printf("echo ===================================\n"); \
  39.             printf("echo cp %s %s\n", $2, $4); \
  40.             printf("echo ===================================\n"); \
  41.             printf("diff %s %s\n", $2, $4); \
  42.         } \
  43.         else { \
  44.             printf("echo ===================================\n"); \
  45.             printf("echo cp %s %s\n", $4, $2); \
  46.             printf("echo ===================================\n"); \
  47.             printf("diff %s %s\n", $4, $2); \
  48.         } \
  49.     } \
  50.     { \
  51.     }' > /tmp/difftree.tmp.$$
  52.  
  53. csh /tmp/difftree.tmp.$$
  54.  
  55. rm /tmp/difftree.tmp.$$
  56.